package com.moyuaninfo.myyserver.controller;

import com.moyuaninfo.myyhikwork.hik.HikSdk;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * 实时预览
 *
 * @author QiuXiangBa
 * @version 1.0
 **/
@Slf4j
@Api(value = "HikRealPlayController", tags = "实时预览")
@RestController
@Validated
public class HikRealPlayController {
    /*@ApiOperation(value = "实时预览 <- 启动")
    @RequestMapping(value = "/hik/realPlay", method = {RequestMethod.POST})
    public String hikRealPlay() {
        HikSdk hikSdk = new HikSdk("192.168.1.102", (short) 8000, "admin", "my123456");

        // 初始化SDK
        hikSdk.initSdk();

        // 注册设备
        hikSdk.loginSdk();

        try {
            Thread.sleep(2000);

            hikSdk.realPlay_V30(33);

            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        // 注销设备
        hikSdk.logoutSdk();

        // 释放SDK资源
        hikSdk.cleanUp();

        return "ok";
    }

    @ApiOperation(value = "实时预览 <- 关闭")
    @RequestMapping(value = "/hik/stopRealPlay", method = {RequestMethod.POST})
    public String hikStopRealPlay(int lRealHandle) {
        HikSdk hikSdk = new HikSdk("192.168.1.102", (short) 8000, "admin", "my123456");

        // 初始化SDK
        hikSdk.initSdk();

        // 注册设备
        hikSdk.loginSdk();

        try {
            Thread.sleep(2000);

            hikSdk.stopRealPlay();

            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        // 注销设备
        hikSdk.logoutSdk();

        // 释放SDK资源
        hikSdk.cleanUp();

        return "ok";
    }*/
}
